import * as TYPES from '@/store/action-types.js'
import {cloneDeep} from "loadsh/lang.js";
let initial = {
    list:null
}
export default function storeReducer(state = initial, action) {
    state = cloneDeep(state)
    switch (action.type) {
        case TYPES.STORE_LIST:
            state.list = action.list
            break
        case TYPES.STORE_REMOVE:
            if (Array.isArray(state.list)) {
                state.list = state.list.filter(item => item.id !== action.id)
            }
            break
        default:
    }
    return state
}